public class Solution {
    public boolean isPalindrome(String s) {
        String s1 = s.toLowerCase().replaceAll("[^0-9a-z]", "");
        StringBuilder sb = new StringBuilder(s1);
        StringBuilder sb2 = new StringBuilder(s1);
        return sb.toString().equals(sb2.reverse().toString());
    }
}